package drds.data_propagate.task;

import drds.data_propagate.task.model.Parameter;
import drds.data_propagate.task.model.TaskConfiguration;

import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TaskManagerImpl implements TaskManager {
    public static Map<String, TaskConfiguration> taskIdToTaskConfigurationMap = new HashMap<String, TaskConfiguration>();

    static {
        TaskConfiguration taskConfiguration = new TaskConfiguration();
        taskConfiguration.setId(1l);
        taskConfiguration.setTaskId("1");
        Parameter parameter = taskConfiguration.getParameter();
        List<InetSocketAddress> inetSocketAddressList = new ArrayList<InetSocketAddress>();
        inetSocketAddressList.add(new InetSocketAddress("192.168.0.110", 3306));
        parameter.setDbAddresses(inetSocketAddressList);
        parameter.setDbUsername("root");
        parameter.setDbPassword("123456");
        parameter.setSlaveId(2l);


        taskIdToTaskConfigurationMap.put("xsx", taskConfiguration);
    }

    public TaskConfiguration findTask(String taskId) {
        return taskIdToTaskConfigurationMap.get(taskId);
    }
    //
    //下面配置不同的任务信息
    //

}
